﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace Ecreate.Data
{
    public class WebConfigAccess
    {
        private DataBaseType _DataBaseType;
        public DataBaseType DataBaseType
        {
            get { return _DataBaseType; }
            set { _DataBaseType = value; }
        }
        private string _ConnectionString;
        public string ConnectionString
        {
            get { return _ConnectionString; }
            set { _ConnectionString = value; }
        }
        public WebConfigAccess()
        {
            object config=null;
            config = System.Configuration.ConfigurationManager.GetSection("DBConfig/DBService");
            string DBType = config.ToString();
            if (DBType.ToLower() == "oracle")
            {
                this.DataBaseType = DataBaseType.Oracle;
            }
            else
            {
                this.DataBaseType = DataBaseType.MSSQLServer;
            }
            string findSection = "DBConfig/DBServiceList/{0}";
            findSection = string.Format(findSection, DBType);
            config = System.Configuration.ConfigurationManager.GetSection(findSection);
            ConnectionString = config.ToString();
        }
    }
}
